package com.easy.merchants.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.easy.merchants.mapper.HouseFacilityMapper;
import com.easy.merchants.pojo.HouseFacility;
import com.easy.merchants.service.HouseFacilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HouseFacilityServiceImpl extends ServiceImpl<HouseFacilityMapper, HouseFacility> implements HouseFacilityService {
    @Autowired
    private HouseFacilityMapper houseFacilityMapper;

    @Override
    public boolean selectByRid(Long rid) {
        HouseFacility houseFacility = new HouseFacility();
        houseFacility.setRid(rid);
        int row = houseFacilityMapper.selectCounts(houseFacility);
        if (row > 0) {
            return true;
        }
        return false;
    }

    @Override
    public HouseFacility selectHouseFacilityByRid(Long rid) {
        HouseFacility houseFacility = new HouseFacility();
        houseFacility.setRid(rid);
        return houseFacilityMapper.selectFacility(houseFacility);
    }

    @Override
    public boolean updateHouseFacilityByRid(HouseFacility houseFacility) {
        int i = houseFacilityMapper.updateFacility(houseFacility);
        if (i > 0) {
            return true;
        }
        return false;
    }
}
